// JavaScript Document

var _URL = 'http://bvthaihoa';

//var _AJAX = _URL + "/ajax.";
var _AJAX = _URL;
var _JS	  = _URL + "/js.";
var _EXT  = _URL + "/external";


function go_post(url,frm,rurl,reload) {
	url = _AJAX + "/" + url;
    var classname = 'info';
    
    if(rurl == undefined ) {
    	rurl = "";
    }
  	if(rurl != "") {
    	rurl = _URL + "/" + rurl;
    }    
    
    if(reload == undefined ) {
    	reload = "";
    }
    
  	osx_waiting(rurl);
    osx_hide_close();
   
    $.post(url, $(frm).serialize(), function(data) {		
    	
    	var x = $.parseJSON(data);
        if(x.result == 'error') {
        	classname='error';
            $("#urlre").text("");
            rurl = "";
            reload = "";
            _eERROR = true;
        } else {
        	classname='ok';
            _eERROR = false;
        }               
        
        osx_set_data("<div class='msg-" + classname + "'>" + x.text + "</div>");
        
        if(x.title == undefined ) {
        	title = "";
        } else {
        	title = x.title;
        }
        osx_show_close();
        
        osx_open(rurl, title )
        
        if(reload!="") {
        	eval(reload);
        }
    });
}

